package com.mp.approvalreq.util;

import com.mp.approvalreq.entity.Overtime;
import com.mp.checkin.util.DateTimeUtils;

import java.util.*;
import java.util.stream.Collectors;

public class OvertimeUtils {

	public static Map<Integer, Overtime> getOvertimeMap(List<Overtime> list) {
		return list.stream().collect(Collectors.toMap(Overtime::getRequestId, overtime -> overtime, (a, b) -> b));
	}

	public static List<Integer> getRequestIds(List<Overtime> overtimes) {
		return overtimes.stream().map(Overtime::getRequestId).collect(Collectors.toList());
	}

	static int getOvertimeDuration(List<Overtime> overtimes) {
		return overtimes.stream().mapToInt(Overtime::getDuration).sum();
	}
}
